<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:34:"./themes/admin/dp/review_edit.html";i:1746500825;s:51:"/lysoo/syzth.lysoo.com/syzth/themes/admin/base.html";i:1741049647;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $setup['title']; ?></title>
    <meta content="<?php echo $setup['keywords']; ?>" name="keywords" />
    <meta content="<?php echo $setup['description']; ?>" name="description" />
    <?php if($setup['ico'] != null): ?><link rel="shortcut icon" type="image/x-icon"  href="/public/uploads/<?php echo $setup['ico']; ?>"/><?php endif; ?>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/public/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/layuiadmin/style/admin.css" media="all">
    <!--CSS引用-->
    
    <!--页面CSS-->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div class="layui-fluid">
  <div class="layui-card">
    <form class="layui-form" action="<?php echo url('admin/dp/edit_review'); ?>" method="post">
      <input type="hidden" name="id" value="<?php echo $review['id']; ?>">

      <div class="layui-form-item">
        <label class="layui-form-label">课程名称</label>
        <div class="layui-input-block">
          <input type="text" name="course_name" value="<?php echo $review['course_name']; ?>" required lay-verify="required" class="layui-input">
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">师资团队</label>
        <div class="layui-input-block">
          <input type="text" name="expert_team" value="<?php echo $review['expert_team']; ?>" class="layui-input">
        </div>
      </div>
       <div class="layui-form-item">
  <label class="layui-form-label">师资</label>
  <div class="layui-input-block">
        <?php if(is_array($expert_list) || $expert_list instanceof \think\Collection || $expert_list instanceof \think\Paginator): if( count($expert_list)==0 ) : echo "" ;else: foreach($expert_list as $key=>$expert): ?>
<input type="checkbox" name="expert_ids[]" title="<?php echo $expert['name']; ?>" value="<?php echo $expert['id']; ?>" 
    <?php if(in_array($expert['id'], $review['expert_ids'])): ?>checked<?php endif; ?>>
    <?php endforeach; endif; else: echo "" ;endif; ?>
  </div>
</div>
      <div class="layui-form-item">
        <label class="layui-form-label">标题图片</label>
        <div class="layui-input-inline">
          <input type="text" name="cover_img" id="cover_img" value="<?php echo $review['cover_img']; ?>" class="layui-input">
        </div>
        <button type="button" class="layui-btn" id="upload_img">上传图片</button>
      </div>
      <?php if($review['cover_img']): ?>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <img id="preview_img" src="<?php echo $review['cover_img']; ?>" style="max-width:200px;">
        </div>
      </div>
      <?php endif; ?>

      <div class="layui-form-item">
        <label class="layui-form-label">回顾视频</label>
        <div class="layui-input-inline">
          <input type="text" name="video_url" id="video_url" value="<?php echo $review['video_url']; ?>" class="layui-input">
        </div>
        <button type="button" class="layui-btn" id="upload_video">上传视频</button>
      </div>
      <?php if($review['video_url']): ?>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <video id="preview_video" src="<?php echo $review['video_url']; ?>" controls style="max-width:300px; max-height:150px;"></video>
        </div>
      </div>
      <?php endif; ?>

      <div class="layui-form-item">
        <label class="layui-form-label">介绍</label>
        <div class="layui-input-block">
          <textarea name="description" class="layui-textarea"><?php echo $review['description']; ?></textarea>
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="submitReviewEdit">提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

<!--页面-->

<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/public/layuiadmin/' //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use('index');
</script>

<script>
layui.use(['form', 'upload'], function(){
  var form = layui.form,
      upload = layui.upload;

  upload.render({
    elem: '#upload_img',
    url: '/index/index/upload',
    field: 'file',
    done: function(res){
      if(res.code === 1){
        var url = '/public/' + res.data.url;
        $('#cover_img').val(url);
        $('#preview_img').attr('src', url).show();
        layer.msg('上传成功');
      } else {
        layer.msg('上传失败');
      }
    }
  });

  upload.render({
    elem: '#upload_video',
    url: '/index/index/upload',
    accept: 'video',
    field: 'file',
    done: function(res){
      if(res.code === 1){
        var url = '/public/' + res.data.url;
        $('#video_url').val(url);
        $('#preview_video').attr('src', url).show();
        layer.msg('上传成功');
      } else {
        layer.msg('上传失败');
      }
    }
  });

  form.on('submit(submitReviewEdit)', function(data){
    $.ajax({
      url: data.form.action,
      type: data.form.method,
      data: $(data.form).serialize(),
      success: function(info){
        if(info.code === 1){
          setTimeout(function(){
            window.location.href = "<?php echo url('admin/dp/review'); ?>";
          }, 1000);
        }
        layer.msg(info.msg);
      }
    });
    return false;
  });
});
</script>

<!--页面JS脚本-->
</body>
</html>

